#ifndef TCP_SSL_H
#define TCP_SSL_H

#include "openssl/rsa.h"
#include "openssl/crypto.h"
#include "openssl/x509.h"
#include "openssl/pem.h"
#include "openssl/ssl.h"
#include "openssl/err.h"
#include "openssl/rand.h" 
#include "openssl/bio.h"


#ifdef __cplusplus
extern "C"{
#endif

	typedef struct st_dealsocket
	{
		int sslType;
		SSL_CTX *ctx;
		int sockfd;
		SSL *ssl;
	}DEALSOCKET;

	int client_ssl_creat(SSL_CTX **ctx, SSL **ssl);
	int client_GenDealSocket(DEALSOCKET *dealsocket, int connectedSocket, int sslType);
	int FreeSocket(int sockfd);
	int FreeDealSocket(DEALSOCKET *dealsocket);

	int SSL_sendMsg(DEALSOCKET dealsocket, char *buff, int buffLen, int timeout);
	int SSL_recvMsg(DEALSOCKET dealsocket, char *buff, int buffLen, int timeout);
	
#ifdef __cplusplus
}
#endif
#endif


